class Benz:pass
class BMW:pass
class BYD:pass

class CarFactory:
    __obj = None
    __init_falg = True

    def __new__(cls,*args,**kwargs):
        if cls.__obj == None:
            cls.__obj = object.__new__(cls)
        return cls.__obj

    def __init__(self):
        if CarFactory.__init_falg:
            CarFactory.__init_falg = False

    def createcar(self,brand):
        if brand == "奔驰":
            return Benz()
        elif brand == "宝马":
            return BMW()
        elif brand == "比亚迪":
            return BYD()
        else:
            return  "未知品牌，无法创建"

factory = CarFactory()
c1 = factory.createcar("奔驰")
c2 = factory.createcar("宝马")
print(c1)
print(c2)
factory2 = CarFactory()
print(factory)
print(factory2)